
function CMsg(){
this.onclick=null;
this.onkeypress=null;
this.oWin=null;
this.iLastMS=0;
this.bRtn=true;
}
CMsg.prototype.mvSet=function(oWin){
this.oWin=(oWin)?oWin:((window.fmMain)?fmMain:window);
if(this.oWin.document.readyState!="complete")return false;
if(this.oWin.msg){return true};
var oEl=this.oWin.document.createElement("<div id=msg class='msgOrg'>");
this.oWin.document.body.appendChild(oEl);
return true;
}
CMsg.prototype.mvMsg=function(zTxt){
if(!this.mvSet())return false;
var oDate=new Date();
if(zTxt==null){
if((oDate.valueOf()-this.iLastMS)<500)return false;
this.oWin.msg.className="msgOrg";
this.oWin.msg.innerHTML="";
this.oWin.document.onclick=this.onclick;
this.oWin.document.onkeypress=this.onkeypress;
return true;
}
this.iLastMS=oDate.valueOf();
this.oWin.msg.style.top=this.oWin.document.body.scrollTop+20;
this.oWin.msg.style.left=this.oWin.document.body.scrollLeft+20;
this.oWin.msg.className="msgSel";
this.oWin.msg.innerHTML=zTxt;
if(this.oWin.document.onclick!=weMsg)this.onclick=this.oWin.document.onclick;
if(this.oWin.document.onkeypress!=weMsg)this.onkeypress=this.oWin.document.onkeypress
this.oWin.document.onclick=weMsg;
this.oWin.document.onkeypress=weMsg;
return true;
}
CMsg.prototype.mvMsgOn=function(zTxt){
if(typeof(zTxt)!="string"){window.status+="!"+typeof(zTxt);return this.bRtn;}
if(!this.mvSet())return false;
var oDate=new Date();
this.iLastMS=oDate.valueOf();
this.oWin.msg.style.top=this.oWin.document.body.scrollTop+20;
this.oWin.msg.style.left=this.oWin.document.body.scrollLeft+20;
this.oWin.msg.className="msgSel";
this.oWin.msg.innerHTML=zTxt;
if(this.oWin.document.onclick!=weMsg)this.onclick=this.oWin.document.onclick;
if(this.oWin.document.onkeypress!=weMsg)this.onkeypress=this.oWin.document.onkeypress
this.oWin.document.onclick=weMsg;
this.oWin.document.onkeypress=weMsg;
return this.bRtn;
}
CMsg.prototype.mvMsgOff=function(){
if(!this.mvSet())return false;
var oDate=new Date();
if((oDate.valueOf()-this.iLastMS)<500)return false;
this.oWin.msg.className="msgOrg";
this.oWin.msg.innerHTML="";
this.oWin.document.onclick=this.onclick;
this.oWin.document.onkeypress=this.onkeypress;
return true;
}
CMsg.prototype.mvShut=function(){
if(!this.mvSet())return false;
if(this.oWin.msg.innerText.substr(0,2)!="★☆")return false;
this.oWin.msg.className="msgOrg";
this.oWin.msg.innerHTML="";
this.oWin.document.onclick=this.onclick;
this.oWin.document.onkeypress=this.onkeypress;
return true;
}
cMsg=new CMsg();

function weMsg(zTxt,bRtn){
switch(weMsg.arguments.length){
case 0:
	return	cMsg.mvMsgOff();
case 1:
	cMsg.bRtn=true;
	return	cMsg.mvMsgOn(zTxt);
default:
	cMsg.bRtn=bRtn;
	return	cMsg.mvMsgOn(zTxt);
}}
function weRtn(aRtn,bRtn){
switch(weRtn.arguments.length){
case 2:
	cMsg.bRtn=bRtn;
	break;
default:
	cMsg.bRtn=false;
}
return cMsg.mvMsgOn("<table><caption>执行错误信息</caption><tr><th>编号<td>"+aRtn.err+"</tr><tr><th>方法<td>"+aRtn.fun+"</tr><tr><th>错误<td>"+aRtn.res+"</tr><tr><th>动作<td>"+aRtn.act+"</tr></table>");
}
